# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html


# useful for handling different item types with a single interface
from itemadapter import ItemAdapter
import pandas as pd


class ScrapyPostFanyiPipeline:
    def process_item(self, item, spider):
        return item


# 导出至excel示例
class SaveExcelPipeline:
    def process_item(self, item, spider):
        data_list = item['data_list']
        df = pd.DataFrame(data=data_list, columns=['电影名称', '电影评分'])
        df.to_excel("电影信息。xlsx", index=False)
        return item
